#include <buola/widgets/ctransparentresizebar.h>

namespace buola { namespace gui {

//////////////////////////////
///////// SResizeBar /////////
//////////////////////////////

CTransparentResizeBar::CTransparentResizeBar()
    :   mResizing(false)
{
    SetPaintMode(EPaintMode::INVISIBLE);
}

CTransparentResizeBar::~CTransparentResizeBar()
{
}

////// events //////

void CTransparentResizeBar::OnButtonDown(const CMouseEvent &pE)
{
    if(pE.mButton==EMouseButton::LEFT)
    {
        mResizing=true;
        mResizePoint=pE.mRootPoint;
    }
}

void CTransparentResizeBar::OnButtonUp(const CMouseEvent &pE)
{
    if(pE.mButton==EMouseButton::LEFT)
    {
        mResizing=false;
    }
}

void CTransparentResizeBar::OnMouseMove(const CMouseEvent &pE)
{
    if(mResizing)
    {
        sResized(pE.mRootPoint-mResizePoint);
        mResizePoint=pE.mRootPoint;
    }
}

/*namespace gui*/ } /*namespace buola*/ }
